<template>
    <div class="common-layout">
        <el-container>
            <!-- 左边 -->
            <el-aside width="240px" class="left-aside-bar">
                <el-container>
                    <el-header class="img">
                    </el-header>
                    <el-main>
                        <IndexMenu />
                    </el-main>
                </el-container>
            </el-aside>
            <!-- 右边 -->
            <el-main class="right-main-info">
                <el-container>
                    <el-header>
                        <div class="dec">
                            <span>欢迎您, {{username}}!</span>
                            <span @click="exit">
                                <el-icon>
                                    <SwitchButton />
                                </el-icon>
                                退出登录
                            </span>
                        </div>

                    </el-header>
                    <el-main>
                        <div class="main-infos-box">
                            <router-view></router-view>
                        </div>
                    </el-main>
                </el-container>
            </el-main>
        </el-container>
    </div>
</template>

<script>
    import IndexMenu from '../components/IndexMenu.vue'
    export default {
        name: 'VueIndex',
        data() {
            return {
                username: window.sessionStorage.getItem("username")
            };
        },

        methods: {
            exit() {
                window.sessionStorage.removeItem("username");
                this.$router.replace("/login");
            }
        },
        components: {
            IndexMenu
        }
    };
</script>

<style lang="scss" scoped>
    .img {
        background: url("../assets/logo.png") no-repeat;
        background-size: 100%;
        background-position: center center;
    }

    .left-aside-bar {
        background: #fff;
    }

    .left-aside-bar .el-header {
        color: #C086FF;
        font-size: 22px;
        font-weight: 600;
        text-align: center;
        line-height: 60px;
    }

    .el-header {
        height: 60px !important;
    }

    .right-main-info .el-header {
        background-color: #5B6BE8;
        height: 300px;
    }

    .right-main-info .el-header div {
        float: right;
        line-height: 60px;
        font-size: 13px;
        color: #fff;
    }

    .right-main-info .el-header div span:first-child {
        margin-right: 10px;
    }

    .right-main-info .el-header div span:last-child {
        cursor: pointer;
    }

    .el-header {
        height: 100px;
    }

    .el-main {
        padding: 0 !important;
    }

    .right-main-info .el-main {
        background-color: #EFF3F6;
    }

    .main-infos-box {
        height: 100%;
        width: 100%;
        margin: 10px 0;
        background-color: #eff3f6;
    }

    /* 左侧  侧边栏 */

    .left-aside-bar ul.ul-total {
        width: 90%;
        margin: 0 auto;
        height: 100%;

    }

    .left-aside-bar ul.ul-total>li {
        margin-top: 20px;
        margin-left: 10px;
        color: rgb(8, 8, 8);
        font-weight: bold;
        border-bottom: 1px solid silver;
    }

    .left-aside-bar ul.ul-total>li .el-icon {
        font-size: 16px;
        margin-right: 5px;
    }

    .left-aside-bar ul.ul-total ul {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .left-aside-bar ul.ul-total ul li {
        margin-top: 10px;
        padding: 5px;
        cursor: pointer;
        color: #919194;
        border-radius: 5px;
    }

    .active {
        background-color: #5264EE;
        color: #fff !important;
    }

    .el-menu {
        background-color: transparent !important;
        border-right: none !important;
    }

    .el-menu-item {
        padding: 10px !important;
        height: 30px !important;
    }

    .el-menu-item:hover {
        background-color: #5F6FED !important;
        color: #fff !important;
    }

    /* 美化滚动条 */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        width: 6px;
        background: rgba(#cee8e3, 0.1);
        -webkit-border-radius: 2em;
        -moz-border-radius: 2em;
        border-radius: 2em;
    }

    ::-webkit-scrollbar-thumb {
        background-color: rgba(144, 147, 153, .5);
        background-clip: padding-box;
        min-height: 28px;
        -webkit-border-radius: 2em;
        -moz-border-radius: 2em;
        border-radius: 2em;
        transition: background-color .3s;
        cursor: pointer;
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: rgba(144, 147, 153, .3);
    }

    /* 内容区域 */
    .main-infos-box {
        box-sizing: border-box;
        padding: 20px;
    }

    .dec span {
        font-weight: 600;
    }

    .dec span:last-child {
        color: #fff;

        .el-icon {
            font-size: 16px;
        }
    }
</style>